import Vue from 'vue'
import Vuex from 'vuex'
import info from './modules/info'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    name: 'admin',
    age: 100
  },
  getters: {
    getName(state) {
      return state.name + '狗娜';
    }
  },
  mutations: {
    changeName(state) {
      state.name += '222';
    },
    changeAge(state,num) {
      state.age += num;
    }
  },
  actions: {
    asyncChange(event) {
      setTimeout(()=>{
        event.commit('changeName')
      },2000)
    }
  },
  modules: {
    info,
  }
})
